"""抽取配置信息"""
import logging
from redis import StrictRedis

class Config(object):
    """工程配置"""
    DEBUG = True
    SECRET_KEY = "DSF"

    """数据库配置"""
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/imformation"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    """redis配置"""
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    REDIS_NUM = 6

    """FLASK_SESSION的配置信息"""
    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_REDIS =StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_NUM)
    PERMANENT_SESSION_LIFETIME = 86410
    SESSION_PERMANENT = False


class DevelopementConfig(Config):
    """开发模式下的配置"""
    DEBUG = True
    LOG_LEVEL = logging.DEBUG

class ProductionConfig(Config):
    """生产模式下的配置"""
    DEBUG = False
    LOG_LEVEL = logging.WARNING

config_dict = {
    "development": DevelopementConfig,
    "production": ProductionConfig
}